// TOWN DIALOGUE SCRIPT
//    Town 122: Pergies

begintalkscript;

variables;

short i,j,k,r1,choice;

// Ilsa

begintalknode;
	tag = 40;
	state = -1;
	nextstate = 1;
	question = "Ilsa";
	text1 = "The bar is being tended by a large and vigorous woman in a black leather jerkin. She has dirty blond hair and a tanned face, covered with smudges of grit.";
	text2 = "_I'm Ilsa. Care for a drink?_ She points at the row of empty mugs, none of which are clean and none of which will ever be clean again.";
	text5 = "Ilsa spends a moment getting a piece of sooty grit out of her eye. Eventually, she says, _Anything else?_";
	action = INTRO;

begintalknode;
	state = 1;
	nextstate = 2;
	question = "_What can I get at this inn?_";
	text1 = "_We have the standard inn fare. Beer is two coins, and a room is twenty. Room's expensive, but very, very nice. And not much worry about slimes._";

begintalknode;
	state = 2;
	nextstate = -1;
	question = "_Why do you charge so much?_";
	text1 = "_We only have two rooms after all. Have to make what money off 'em we can!_";

begintalknode;
	state = 2;
	nextstate = 4;
	question = "_Do you have much of a slime problem?_";
	text1 = "She looks very worried. _There aren't many of them out here, thank Heavens, but they're coming. Mark my words. Hope something's done about it soon. I'm worried sick about my daughter._";
	text3 = "She sighs. _They say the slimes are all dead, but there's still a few of 'em around. I try to keep my daughter indoors, but she won't have any of it!_";
	action = DEP_ON_SDF 307 3 0;

begintalknode;
	state = 4;
	nextstate = -1;
	question = "_Who's your daughter?_";
	text1 = "_Her name's Susie. She'll be around here somewhere, that little tomboy. I just hope if she sees a slime she has the sense to run, instead of throwing rocks at it or trying to make it a pet, or some insane thing like that!_";

	
begintalknode;
	state = 1;
	nextstate = -1;
	condition = coins_amount() >= 20;
	question = "_I'll take a room._ Pay twenty coins.";
	text1 = "She takes your gold and gives you a key. _Second door on the right. Sweet dreams!_ The room is surprisingly clean. Only a small amount of soot has made its way in here.";
	action = END_TALK;	
	code =
		revive_party();
		change_coins(-20);
		relocate_char(get_pc_id(0),17,13,FALSE);
		relocate_char(get_pc_id(1),18,13,FALSE);
		relocate_char(get_pc_id(2),18,14,FALSE);
		relocate_char(get_pc_id(3),17,14,FALSE);
	break;


begintalknode;
	state = 1;
	nextstate = 3;
	condition = coins_amount() >= 2;
	question = "_I'll take some beer._ Pay 2 coins.";
	text1 = "The beer is excellent, if a bit gritty from all the dust. By way of conversation, Ilsa says, _Watch out for that weird priest. We have some odd people staying with us._";
	code =
		force_char_status(30000,1,20);
		change_coins(-2);
	break;


begintalknode;
	state = 3;
	nextstate = -1;
	question = "_What weird priest?_";
	text1 = "_He says his name's Paulo. He's in the first room. He says he teaches spells, but I think he's a bit creepy. Still, as long as he pays for his room and doesn't bug anybody, he's not so awful._";

begintalknode;
	state = 1;
	nextstate = -1;
	condition = 1;
	question = "_I have to go._";
	text1 = "She tries to say something, but she is interrupted by a bout of coughing.";
	action = END_TALK;

// Paulo

begintalknode;
	tag = 60;
	state = -1;
	nextstate = 29;
	question = "Paulo";
	text1 = "A man with dark skin and an intense expression sits at the table, reading a prayer book. He seems strangely unconcerned that you just barged into his room. He wears ominous, blood-red robes.";
	text2 = "_Welcome, pilgrim. I am simply called Paulo. A traveler. A teacher._";
	text5 = "Paulo stares at you, expectantly. _I am glad to speak with you further. I have much to share._";
	action = INTRO;

begintalknode;
	state = 29;
	nextstate = 30;
	question = "_So why are you staying at this inn?_";
	text1 = "_I am a humble priest, wandering the lands and spreading my teachings. For now, I have found this village a pleasant place to stay._";

begintalknode;
	state = 30;
	nextstate = -1;
	question = "_So you're humble._";
	text1 = "_Sometimes it is a struggle to be humble, considering the foolishness and idiocy I must encounter every day. But I manage._";

begintalknode;
	state = 30;
	nextstate = 31;
	question = "_Why do you like this village?_";
	text1 = "_Pergies is pleasant and far from most of the monsters that afflict Valorim. I plan to stay here for some time._";
	text2 = "_Alas, not all in this area are entirely savory._";

begintalknode;
	state = 31;
	nextstate = 32;
	question = "_What area did you find most unsavory?_";
	text1 = "_The village of Delis, to the south, is a rather immoral place, for example. In fact, some people there, and I consider them only barely human, committed the theft of a package of my herbs._";
	text3 = "_The village of Delis, to the south, was a rather immoral place. Then the slimes rose up and took the town by surprise. The place is a ruin. It's a great annoyance. One person there had stolen some of my herbs._";
	code =
		if (day_reached(60,0))
			remove_string(1);
			else remove_string(3);
	break;

begintalknode;
	state = 32;
	nextstate = -1;
	condition = gf(122,0) <= 1;
	question = "_Perhaps I can recover your stolen herbs?_";
	text1 = "_Delis is the home to all manner of pirate scum! I know for a fact that one of them took a package of herbs from a ship coming from the north, and that it's hidden in a back room in the inn there._";
	text2 = "_I'd reward well someone who brought that package to me. Just be careful. Those parasites protect their own._";
	action = SET_SDF 122 0 1;
	code =
		toggle_quest(27,1);
	break;
	
begintalknode;
	state = 29;
	nextstate = 33;
	question = "_What do you teach?_";
	text1 = "His face beams. _Ah! You wish to take the path to enlightenment? Are you more interested in philosophy or magic?_";

begintalknode;
	state = 33;
	nextstate = 36;
	question = "_Magic, please._";
	text1 = "_I know several simple rituals, which may easily be adapted to the workings of your faith. Alas, I need to eat. I will require a small fee, should you wish to purchase my knowledge._";

begintalknode;
	state = 36;
	nextstate = -1;
	question = "_Fair enough. What spells can you teach?_";
	text1 = "You conclude your business.";
	code =
		begin_shop_mode("Paulo's Rituals","Paulo is a strange and cynical man, but he is able to provide instruction in some of the more practical and dangerous magical rituals.",42,3,3);
	break;

begintalknode;
	state = 33;
	nextstate = 34;
	question = "_Philosophy sounds intriguing._";
	text1 = "_I teach the divinely inspired philosophy of Divine Independence._";

begintalknode;
	state = 34;
	nextstate = 35;
	question = "_What is Divine Independence?_";
	text1 = "_We have been given by our creators the greatest gift of all: the ability to act as independent creatures. This has a much ignored accompanying responsibility, however: the responsibility to remain independent._";
	text2 = "_Those who lose their independence are parasites. One should only take from others as part of a fair trade._";

begintalknode;
	state = 35;
	nextstate = -1;
	question = "_So you don't care about the sick, poor or young then?_";
	text1 = "_Let's just say that the other churches are perfectly free to saddle themselves with the poor and crippled. We take only those who can help us, and who want the divine freedom to not help others._";

begintalknode;
	state = 35;
	nextstate = 32;
	question = "_What sorts of fair trades?_";
	text1 = "He thinks for a bit. _Fair trades take all forms. For example, I recently tried to obtain a package of herbs for my art. Parasites took my herbs from me, in a crude act of theft._";

begintalknode;
	state = 29;
	nextstate = -1;
	condition = gf(122,0) == 1 && has_spec_item(22) > 0;
	question = "_I found your package._ (Give it to him.)";
	code =
		run_hardcode(121);
	break;

begintalknode;
	state = 29;
	nextstate = -1;
	condition = gf(122,0) >= 2;
	question = "_What was in that package?_";
	text1 = "_Skribbane herb. A useful herb for meditation. I give it to my acolytes. It maintains their alertness and loyalty._";

// Susie

begintalknode;
	tag = 80;
	state = -1;
	nextstate = 57;
	question = "Susie";
	text1 = "You think that this girl might be about ten. However, she's so covered by grime and ore dust that she could also be any age from four to sixteen. _Hi, I'm Susie!_ she says.";
	text5 = "Susie watches you with interest. You must be the most interesting people to visit Pergies in a long time.";
	action = INTRO;

begintalknode;
	state = 57;
	nextstate = 58;
	question = "_What are you doing?_";
	text1 = "_I'm looking for slimes!_";

begintalknode;
	state = 58;
	nextstate = 59;
	question = "_Isn't that dangerous?_";
	text1 = "_They're big and nasty, and when I see one I yell so the guards can kill them!_";

begintalknode;
	state = 59;
	nextstate = 60;
	question = "_Don't you get frightened of the slimes?_";
	text1 = "_Na. I want to be a big adventurer and go to Avernum!_";

begintalknode;
	state = 60;
	nextstate = 61;
	question = "_Why did you pick Avernum?_";
	text1 = "_I hear there are weird pale people and big evil monsters down there, and I can fight them and get treasure!_";

begintalknode;
	state = 61;
	nextstate = 62;
	question = "_And what would you do with the treasure?_";
	text1 = "_Be rich and famous!_";

begintalknode;
	state = 62;
	nextstate = -1;
	question = "_So then you'll be happy?_";
	text1 = "_Yeah! And then I can go to bed whenever I want!_";
	text2 = "She squats on the ground and picks at a scab on her knee reflectively, pondering this wondrous fate.";

begintalknode;
	state = 61;
	nextstate = -1;
	question = "_You mean pale like me?_";
	text1 = "_Yeah!_ She stops and thinks. _A lot like you. Better be careful! People might think you're from Avernum and are big monsters and stuff._";

begintalknode;
	state = 61;
	nextstate = -1;
	question = "_There are a lot of monsters in Avernum._";
	text1 = "_Monsters are bad!_";
	
// Denzil

begintalknode;
	tag = 540;
	state = -1;
	nextstate = 941;
	question = "Denzil";
	text1 = "You meet a seedy-looking sailor, walking around town looking bored. He shuffles over to you. It seems he finds talking to you preferable to doing nothing. _I'm called Denzil. Howdya' do?_";
	text5 = "Denzil scratches himself. He looks very bored. Even bored enough to talk to wandering adventurers.";
	action = INTRO;

begintalknode;
	state = 941;
	nextstate = 942;
	question = "_Do you have an occupation?_";
	text1 = "He shrugs and spits. _Normally, I'm a sailor. It's a disaster for people in my trade these days, I tells' ya'!_ ";

begintalknode;
	state = 942;
	nextstate = 943;
	question = "_Do you like being a sailor?_";
	text1 = "He scratches a tattooed arm. _Eh. Bad trade to be in these days. Nobody is shipping anything anywhere. Too many monsters._";

begintalknode;
	state = 942;
	nextstate = 943;
	question = "_What's a disaster?_";
	text1 = "_No ships going anywhere these days. Everyone's afraid of being brought more monsters, or being attacked, or this and that. Me, I plan to keep moving._";

begintalknode;
	state = 943;
	nextstate = 944;
	question = "_People must be afraid of the slimes spreading._";
	text1 = "_Betcha' think this is the only place with lots of monsters. Don't kid yourself. I've heard the rumors. We sailors get around. There's monsters running around everywhere. Watch your back._";
	text2 = "_As for me, I'm running._";

begintalknode;
	state = 944;
	nextstate = -1;
	question = "_Where are you moving to?_";
	text1 = "_I'm waiting to sign on with some merchants going west. There's a town called Pergies to the west, hasn't been attacked much. Maybe I'll be safe there. Sure getting out of here as soon as I can. Way too many monsters!_ ";
	text2 = "_Well, Pergies is about the end of nowhere. But if more monsters show up, I'll keep running even if I have to swim the ocean!_ ";
	code =
		if (which_town() == 0)
			rs(2);
			else rs(1);
	break;
	
begintalknode;
	state = 941;
	nextstate = 945;
	question = "_You look like you've traveled a lot. Heard any rumors?_";
	text1 = "He leans close to you, close enough for you to savor his somewhat acrid smell. _In fact, I have. Want to hear what I've heard?_";

begintalknode;
	state = 945;
	nextstate = 946;
	question = "_Sure._";
	text1 = "_I've heard that the Avernites walk among us. They're found a way to come to the surface and they're traveling around._";

begintalknode;
	state = 946;
	nextstate = -1;
	question = "_And do you believe this?_";
	text1 = "_Hell no! The Empire itself put them down there. I believe that anyone the Empire puts away stays put away. I think it'll take a lot more than a bunch of ignorant cave dwellers to put one over on the Empire._";
	text2 = "He nods, confident he's given you some solid advice. Then he moves on.";
	action = END_TALK;
